package com.thb.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class ValidationUtil {
	
	public static boolean isMail(String mail){
		  String str="^([a-zA-Z0-9]*[-_]?[a-zA-Z0-9]+)*@([a-zA-Z0-9]*[-_]?[a-zA-Z0-9]+)+[\\.][A-Za-z]{2,3}([\\.][A-Za-z]{2})?$";
	        Pattern p = Pattern.compile(str);     
	        Matcher m = p.matcher(mail); 
	        return m.matches();     
	}
	
	public static boolean checkLength(int max,int min,String str){
		if(str==null){
			return true;
		}
		if(str.length()>max){
			return false;
		}
		
		if(str.length()<min){
			return false;
		}
		
		return true;
	}

}
